<?php
class BaseWidget extends CWidget
{
    public $baseUrl;

    public function init()
    {
        $this->baseUrl = Yii::app()->getBaseUrl(true);
    }

    public function render($view, $data = null, $js = null, $css = null, $return = false)
    {
        // autoload
        AssetUtility::addCss('widgets/'.$view.'.css');
        AssetUtility::addJs('widgets/'.$view.'.js');
        
        // js
        if(is_array($js))
        {
            foreach($js as $file)
            {
                AssetUtility::addJs($file);
            }
        }

        // css
        if(is_array($css))
        {
            foreach($css as $file)
            {
                AssetUtility::addCss($file);
            }
        }

        return parent::render($view, $data, $return);
    }
}